package com.cloudkinto.service.order.vo.mabang;

import java.util.HashMap;
import java.util.Map;

/**
 * @author long
 */

public enum WarehouseCodeEnum {
    /**
     *
     */
    yamato("ヤマト運輸", "yamato"),
    sagawa("佐川急便", "sagawa"),
    seino("西浓运输", "seino"),
    jpost("日本郵便", "jpost");

    private final String name;

    private final String code;

    WarehouseCodeEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }


    public static String getCode(String name) {
        for (WarehouseCodeEnum warehouseCodeEnum : values()) {
            if (name.contains(warehouseCodeEnum.name)) {
                return warehouseCodeEnum.code;
            }
        }
        return null;
    }

    public static Map<String,String> getCodeMap(){
        Map<String,String> map = new HashMap<>();
        for (WarehouseCodeEnum warehouseCodeEnum : values()) {
            map.put(warehouseCodeEnum.code, warehouseCodeEnum.name);
        }
        return map;
    }
}
